<template>
  <BaseContainer>
    <aplid-base-crud ref="crud" class="w-100" v-bind="{...theConfig,...$attrs}" :paramsObj="{seniorLiving:1,...paramsObj}">
      <template v-slot:ArchivesDialog="{ row, show }">
        <Archives @refresh="handleRefresh" @refreshPage="handleRefreshPage" @rechange="handleOperate"
          :api="baseConfig.api" :key="show" :nowRowData="row"></Archives>
      </template>
     
    </aplid-base-crud>

   
  </BaseContainer>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import Archives from '@/views/datacenter/basicData/homeOldman/Archives/index.vue'
import { getStore } from '@/utils/store'

type Props = {
  isComprehensiveQueries?:boolean
}
let props = withDefaults(defineProps<Props>(),{
  isComprehensiveQueries:false,
})
// 判断是否是服务商，是的话不需要数据权限
let paramsObj = ref({})
let userInfo = getStore('userInfo')||{}
paramsObj.value = {
	isWithAuth:userInfo.classifyId==5?0:1
}

let theConfig :any= ref({})
if(baseConfig){
  let defaultConfig = JSON.parse(JSON.stringify(
    baseConfig
  ))
  if(props.isComprehensiveQueries){
    theConfig.value = (defaultConfig)
  }else{
    theConfig.value = baseConfig
  }
  
}

const crud = ref()
let nowData: any = {}
const dialogVisible = ref(false)
const handleRefresh = (query, visible = false) => {
  dialogVisible.value = visible
  nextTick(() => {
    crud.value.refreshChange(query)
  })
}
const handleOperate = (type, row, title) => {
  console.log('返回',type, row, title)
  nextTick(() => {
    crud.value.handleOperate(type, row, title)
  })
}
const handleRefreshPage = () => {
  nextTick(() => {
    crud.value.refreshChange({}, true)
  })
}
const handleChange = (row) => {
  nowData = row
  dialogVisible.value = true
}
defineExpose({
  handleRefresh
})
</script>

<style scoped></style>
